package br.edu.fa7.quotes.model;

import br.edu.fa7.quotes.R;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class QuoteAdapter extends BaseAdapter {

	private Context ctx;
	private Quote quote;

	public QuoteAdapter(Context ctx, Quote quote) {
		super();
		this.ctx = ctx;
		this.quote = quote;
	}

	@Override
	public int getCount() {
		if (quote != null) {
			return 1;
		}
		return 0;
	}

	@Override
	public Object getItem(int position) {
		return quote;
	}

	@Override
	public long getItemId(int position) {
		return quote.getIdQuote();
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {

		View v = LayoutInflater.from(ctx).inflate(R.layout.activity_main, null);

		TextView tv1 = (TextView) v.findViewById(R.id.txtWelcome);
		tv1.setText(R.string.strWelcome);

		return v;
	}

}
